# syntax=docker/dockerfile:1

FROM golang:1.23 as builder
WORKDIR /app

COPY go.work ./
COPY shared ./shared
COPY proto ./proto
COPY services ./services

WORKDIR /app/services/ai-gateway
RUN --mount=type=cache,target=/go/pkg/mod \
    --mount=type=cache,target=/root/.cache/go-build \
    go build -o /out/ai-gateway ./cmd

FROM gcr.io/distroless/base-debian12
WORKDIR /app
COPY --from=builder /out/ai-gateway /app/ai-gateway
EXPOSE 50053
ENTRYPOINT ["/app/ai-gateway"]
